
#pragma once

#include "type.h"
#include "gamemessage.h"

#include <map>
using namespace std;
    
class FlagMenuLayer: public Layer, public MessageHolder {
public:
    FlagMenuLayer();
    virtual ~FlagMenuLayer();

	CREATE_FUNC(FlagMenuLayer);

	void showLayer(const Point& pos);
	void closeLayer();
	void update (float ticks);

	virtual bool ccTouchBegan(Touch *touch, Event *event);
	virtual void ccTouchMoved(Touch *touch, Event *event);
	virtual void ccTouchEnded(Touch *touch, Event *event);
	virtual void ccTouchCancelled(Touch *touch, Event *event);

public:
	SoldierType soldierType;

private:
    virtual bool init();
	
	void handleMessage();
    
    void onLayerAnimationFinished();

	void addPriceTag(Node* node, int price);

	SoldierType checkTouch(const Point& pt);

private:
	Sprite* _menuBg;	
	Sprite* _unitIcons[(int)SoldierType::count];
    
	bool _isAnimating;

	char buf[100];
};
